package com.example.aerospacemanagementsystem.controller.basic;

import com.example.aerospacemanagementsystem.entity.basic.User;
import com.example.aerospacemanagementsystem.service.basicService.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 铁殷
 */
@Api(tags = "用户")
@RestController
@CrossOrigin
@RequestMapping("/user")

public class UserController {

    @Autowired
    private UserService userService;
    //添加用户
    @PostMapping
    public int add(@RequestBody User user){
        return userService.add(user);
    }
    //删除用户
    @DeleteMapping
    public int delete(User user){
        return userService.delete(user);
    }
    //修改用户
    @PutMapping
    public int update(@RequestBody User user){
        return userService.update(user);
    }
    //获取用户
    @GetMapping("/getAll")
    public List<User> getAllCity(User user) {
        List<User> list = userService.getAllUser(user);
        return list;
    }
}
